load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "serverinfo",
    srcs = [
        "info.go",
        "syncer.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/domain/serverinfo",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config",
        "//pkg/ddl/util",
        "//pkg/kv",
        "//pkg/metrics",
        "//pkg/parser/mysql",
        "//pkg/util",
        "//pkg/util/etcd",
        "//pkg/util/hack",
        "//pkg/util/logutil",
        "//pkg/util/versioninfo",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@io_etcd_go_etcd_client_v3//:client",
        "@io_etcd_go_etcd_client_v3//concurrency",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "serverinfo_test",
    timeout = "short",
    srcs = ["syncer_test.go"],
    embed = [":serverinfo"],
    flaky = True,
    shard_count = 2,
    deps = [
        "//pkg/config",
        "//pkg/config/kerneltype",
        "//pkg/keyspace",
        "//pkg/testkit/testsetup",
        "//pkg/util",
        "//pkg/util/etcd",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
        "@io_etcd_go_etcd_tests_v3//integration",
        "@org_uber_go_goleak//:goleak",
    ],
)
